package hiatao.puzzle.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

import haitao.puzzle.R;
import hiatao.puzzle.adapter.ListFollowAdapter;
import hiatao.puzzle.entity.User;
import hiatao.puzzle.utils.StatusBarCompat;
import hiatao.puzzle.widget.XListView;

public class FollowActivity  extends Activity{

    private XListView listview;
    private  ListFollowAdapter adapter;
    private TextView title_tv;
    
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
    	setContentView(R.layout.activity_follow);
		findViews();
		init();
		StatusBarCompat.compat(this, getResources().getColor(R.color.primary));
    }
	private void findViews() {
		
        listview = (XListView) findViewById(R.id.listview);
        title_tv = (TextView) findViewById(R.id.title_tv);
	}

	private void init() {
		adapter  = new ListFollowAdapter(this, getTestData());
		listview.setPullLoadEnable(false);
		listview.setPullRefreshEnable(false);
		listview.setAdapter(adapter);
		String title = getIntent().getStringExtra("TITLE");
		title_tv.setText(title);
		findViewById(R.id.top_back).setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				FollowActivity.this.finish();
			}
		});
	}

	private List<User> getTestData() {
		List<User> userList = new ArrayList<User>();
		User u1= new User();
		u1.setName("张小丑@");
		u1.setIntro("爱拼才会赢！");
		u1.setFocus(true);
		u1.setHeadUrl("https://raw.githubusercontent.com/583472074/photo/master/u"+1+".png");
		userList.add(u1);
		
		User u2= new User();
		u2.setName("百变萝莉,๓");
		u2.setFocus(false);
		u2.setIntro("你说你喜欢海其实你喜欢浪");
		u2.setHeadUrl("https://raw.githubusercontent.com/583472074/photo/master/u"+2+".png");
		userList.add(u2);
		
		User u3= new User();
		u3.setName("Big Big Bang!");
		u3.setIntro("留不住的人像阵风遇见就离开.");
		u3.setFocus(true);
		u3.setHeadUrl("https://raw.githubusercontent.com/583472074/photo/master/u"+3+".png");
		userList.add(u3);
		
		User u4= new User();
		u4.setName("丑人多作怪");
		u4.setFocus(true);
		u4.setIntro("爱情原如树叶一样，在人忽视里绿了，在忍耐里露出蓓蕾");
		u4.setHeadUrl("https://raw.githubusercontent.com/583472074/photo/master/u"+4+".png");
		userList.add(u4);
		
		User u5= new User();
		u5.setName("放肆找");
		u5.setIntro("一件事实是一条没有性别的真理");
		u5.setFocus(false);
		u5.setHeadUrl("https://raw.githubusercontent.com/583472074/photo/master/u"+5+".png");
		userList.add(u5);
		
		
		User u6= new User();
		u6.setName("Absurd＇");
		u6.setFocus(false);
		u6.setIntro("友谊是一棵可以庇荫的树。");
		u6.setHeadUrl("https://raw.githubusercontent.com/583472074/photo/master/u"+6+".png");
		userList.add(u6);
		
		User u7= new User();
		u7.setName("ζั͡ޓއއއ 丶陌影°");
		u7.setIntro("真正的才智是刚毅的意志");
		u7.setFocus(true);
		u7.setHeadUrl("https://raw.githubusercontent.com/583472074/photo/master/u"+7+".png");
		userList.add(u7);
		return userList;
	}

}
